Click here for interactive plots:

https://kforthman.shinyapps.io/COVID19_Interactive_Plots/

Click here to see how cities and counties overlap:

https://kforthman.shinyapps.io/500citiescounties

Compare COVID stats to Neighborhood Factors

data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

Compare COVID stats to 500 cities data and Neighborhood Factors

data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

—-Linear Mixed Effects Model —-

this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling

## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
##    Data: county.Demo_and_Covid.500counties
## 
## REML criterion at convergence: -1203.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.0674 -0.3056 -0.0687  0.2019  6.2770 
## 
## Random effects:
##  Groups   Name        Variance    Std.Dev.
##  stateID  (Intercept) 0.000001959 0.001400
##  Residual             0.000012843 0.003584
## Number of obs: 178, groups:  stateID, 33
## 
## Fixed effects:
##                                  Estimate     Std. Error             df
## (Intercept)                 -0.0123512126   0.0098299025  76.1935681199
## Affluence                    0.0047917050   0.0011144008 112.3467540308
## Singletons.in.Tract          0.0007809158   0.0009022809 148.8040151883
## Seniors.in.Tract             0.0005689063   0.0011881947 154.8291844011
## African.Americans.in.Tract   0.0010174701   0.0009913028 155.5449895391
## Noncitizens.in.Tract         0.0010009696   0.0007684588 129.1588737368
## High.BP                      0.0001957696   0.0001888297 120.6843513404
## Binge.Drinking               0.0001798986   0.0001623035  49.5852280689
## Cancer                      -0.0012724124   0.0011142254 113.2668658538
## Asthma                       0.0008474238   0.0005733608  53.6697044247
## Heart.Disease                0.0017443244   0.0013218150  85.4300617400
## COPD                        -0.0003121978   0.0010998810  84.1694042879
## Smoking                     -0.0000308360   0.0002295060  90.7314416507
## Diabetes                    -0.0007022166   0.0005395354  89.6535073575
## No.Physical.Activity        -0.0000720930   0.0002079870  98.6028384549
## Obesity                      0.0002873328   0.0001777978 120.3554541997
## Poor.Sleeping.Habits        -0.0000549025   0.0001653870 130.7718628417
## Poor.Mental.Health          -0.0000842616   0.0004375961  35.0113973609
## Testing_Rate                 0.0000006624   0.0000002758  44.2698134349
## Hospitalization_Rate        -0.0000640894   0.0000962549  30.4993754427
##                            t value  Pr(>|t|)    
## (Intercept)                 -1.256    0.2128    
## Affluence                    4.300 0.0000366 ***
## Singletons.in.Tract          0.865    0.3882    
## Seniors.in.Tract             0.479    0.6328    
## African.Americans.in.Tract   1.026    0.3063    
## Noncitizens.in.Tract         1.303    0.1950    
## High.BP                      1.037    0.3019    
## Binge.Drinking               1.108    0.2730    
## Cancer                      -1.142    0.2559    
## Asthma                       1.478    0.1453    
## Heart.Disease                1.320    0.1905    
## COPD                        -0.284    0.7772    
## Smoking                     -0.134    0.8934    
## Diabetes                    -1.302    0.1964    
## No.Physical.Activity        -0.347    0.7296    
## Obesity                      1.616    0.1087    
## Poor.Sleeping.Habits        -0.332    0.7404    
## Poor.Mental.Health          -0.193    0.8484    
## Testing_Rate                 2.402    0.0206 *  
## Hospitalization_Rate        -0.666    0.5105    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of fixed effects could have been required in summary()
## 
## Correlation of Fixed Effects:
##             (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence    0.106                                                        
## Sngltns.n.T  0.029  0.071                                                 
## Snrs.n.Trct  0.545  0.387  0.197                                          
## Afrcn.Am..T  0.146  0.156 -0.401  0.148                                   
## Nnctzns.n.T -0.006  0.099  0.036  0.063 -0.086                            
## High.BP     -0.021  0.244  0.057  0.107 -0.086  0.386                     
## Bing.Drnkng -0.308 -0.169 -0.291 -0.164  0.072  0.027  0.125              
## Cancer      -0.591 -0.184  0.180 -0.316 -0.071 -0.132 -0.362 -0.089       
## Asthma      -0.400 -0.201 -0.254 -0.215  0.086  0.092  0.164  0.003  0.071
## Heart.Dises -0.153  0.079 -0.301 -0.156  0.249 -0.107 -0.002  0.056 -0.471
## COPD         0.574  0.026  0.156  0.280 -0.023  0.276  0.155  0.087 -0.280
## Smoking     -0.145  0.146 -0.177 -0.106 -0.049  0.016 -0.060 -0.303  0.076
## Diabetes     0.097 -0.351 -0.103 -0.219 -0.306 -0.308 -0.535  0.048  0.235
## N.Physcl.Ac -0.195 -0.032  0.082 -0.025 -0.032 -0.228 -0.088  0.121  0.472
## Obesity      0.001  0.416  0.434  0.302  0.135  0.189 -0.092 -0.225  0.104
## Pr.Slpng.Hb -0.441 -0.390  0.138 -0.352 -0.338 -0.034 -0.188  0.099  0.137
## Pr.Mntl.Hlt -0.352  0.267 -0.067 -0.045  0.098 -0.163 -0.052  0.091  0.330
## Testing_Rat  0.238 -0.078  0.009  0.036  0.022 -0.047 -0.031 -0.032 -0.218
## Hsptlztn_Rt -0.120 -0.235 -0.100 -0.232 -0.063 -0.072 -0.108 -0.143  0.023
##             Asthma Hrt.Ds COPD   Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence                                                                 
## Sngltns.n.T                                                               
## Snrs.n.Trct                                                               
## Afrcn.Am..T                                                               
## Nnctzns.n.T                                                               
## High.BP                                                                   
## Bing.Drnkng                                                               
## Cancer                                                                    
## Asthma                                                                    
## Heart.Dises  0.275                                                        
## COPD        -0.389 -0.561                                                 
## Smoking      0.087  0.210 -0.502                                          
## Diabetes    -0.122 -0.303 -0.078  0.222                                   
## N.Physcl.Ac  0.018 -0.379 -0.015 -0.328 -0.081                            
## Obesity     -0.264 -0.090  0.161 -0.200 -0.385 -0.060                     
## Pr.Slpng.Hb  0.073  0.246 -0.190 -0.030 -0.020 -0.105 -0.164              
## Pr.Mntl.Hlt -0.225  0.085 -0.456  0.066  0.010  0.059  0.078 -0.167       
## Testing_Rat -0.343 -0.029  0.220  0.140  0.116 -0.307  0.119 -0.146 -0.158
## Hsptlztn_Rt  0.103  0.105 -0.107  0.101  0.065 -0.053 -0.033 -0.015 -0.105
##             Tstn_R
## Affluence         
## Sngltns.n.T       
## Snrs.n.Trct       
## Afrcn.Am..T       
## Nnctzns.n.T       
## High.BP           
## Bing.Drnkng       
## Cancer            
## Asthma            
## Heart.Dises       
## COPD              
## Smoking           
## Diabetes          
## N.Physcl.Ac       
## Obesity           
## Pr.Slpng.Hb       
## Pr.Mntl.Hlt       
## Testing_Rat       
## Hsptlztn_Rt  0.182
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)

print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
##    Data: county.Demo_and_Covid.500counties
## 
## REML criterion at convergence: -2465.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6790 -0.3724 -0.0739  0.2446  6.8638 
## 
## Random effects:
##  Groups   Name        Variance    Std.Dev.
##  stateID  (Intercept) 0.000007308 0.002703
##  Residual             0.000011654 0.003414
## Number of obs: 326, groups:  stateID, 51
## 
## Fixed effects:
##                                Estimate   Std. Error           df t value
## (Intercept)                 -0.02140957   0.00771358 195.54186772  -2.776
## Affluence                    0.00282174   0.00069812 303.08988393   4.042
## Singletons.in.Tract          0.00082282   0.00065092 300.54473214   1.264
## Seniors.in.Tract             0.00040801   0.00082234 304.28385289   0.496
## African.Americans.in.Tract   0.00166644   0.00079506 306.59642385   2.096
## Noncitizens.in.Tract         0.00171672   0.00064276 274.04468546   2.671
## High.BP                     -0.00002198   0.00014408 299.96234293  -0.153
## Binge.Drinking               0.00037583   0.00015200 162.83640155   2.473
## Cancer                      -0.00033234   0.00084602 268.87153157  -0.393
## Asthma                       0.00064920   0.00050411 144.46523394   1.288
## Heart.Disease                0.00297286   0.00108691 215.47370255   2.735
## COPD                        -0.00117145   0.00082291 209.61703924  -1.424
## Smoking                     -0.00022335   0.00019001 254.92087021  -1.175
## Diabetes                    -0.00110155   0.00040702 271.74843821  -2.706
## No.Physical.Activity         0.00029776   0.00016362 241.29287072   1.820
## Obesity                      0.00022866   0.00013214 307.89260848   1.731
## Poor.Sleeping.Habits         0.00025114   0.00012735 298.13961754   1.972
## Poor.Mental.Health          -0.00013631   0.00042838 105.56662407  -0.318
##                             Pr(>|t|)    
## (Intercept)                  0.00605 ** 
## Affluence                  0.0000673 ***
## Singletons.in.Tract          0.20718    
## Seniors.in.Tract             0.62014    
## African.Americans.in.Tract   0.03690 *  
## Noncitizens.in.Tract         0.00802 ** 
## High.BP                      0.87886    
## Binge.Drinking               0.01444 *  
## Cancer                       0.69476    
## Asthma                       0.19987    
## Heart.Disease                0.00675 ** 
## COPD                         0.15607    
## Smoking                      0.24090    
## Diabetes                     0.00723 ** 
## No.Physical.Activity         0.07002 .  
## Obesity                      0.08454 .  
## Poor.Sleeping.Habits         0.04953 *  
## Poor.Mental.Health           0.75096    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of fixed effects could have been required in summary()
## 
## Correlation of Fixed Effects:
##             (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence   -0.054                                                        
## Sngltns.n.T -0.054  0.042                                                 
## Snrs.n.Trct  0.391  0.293  0.073                                          
## Afrcn.Am..T  0.241  0.076 -0.404  0.202                                   
## Nnctzns.n.T -0.072  0.153  0.125  0.058 -0.192                            
## High.BP     -0.094  0.158  0.098  0.008 -0.232  0.325                     
## Bing.Drnkng -0.491 -0.037 -0.204 -0.067  0.041 -0.076  0.148              
## Cancer      -0.494 -0.095  0.231 -0.170 -0.074 -0.065 -0.330 -0.018       
## Asthma      -0.271 -0.094 -0.262 -0.122 -0.016  0.212  0.049  0.010 -0.156
## Heart.Dises -0.059  0.079 -0.302 -0.132  0.213 -0.055  0.002  0.034 -0.603
## COPD         0.479  0.007  0.130  0.171 -0.007  0.156  0.056  0.058 -0.211
## Smoking     -0.041  0.105 -0.119 -0.138 -0.104  0.159 -0.082 -0.327  0.156
## Diabetes     0.036 -0.302 -0.077 -0.132 -0.230 -0.250 -0.447  0.074  0.369
## N.Physcl.Ac -0.117  0.035  0.102  0.079  0.059 -0.275  0.004  0.128  0.334
## Obesity     -0.066  0.382  0.398  0.201  0.132  0.192 -0.103 -0.145  0.118
## Pr.Slpng.Hb -0.384 -0.349  0.162 -0.324 -0.320 -0.046 -0.156  0.087  0.028
## Pr.Mntl.Hlt -0.353  0.184 -0.009  0.025  0.053 -0.164  0.030  0.130  0.416
##             Asthma Hrt.Ds COPD   Smokng Diabts N.Ph.A Obesty Pr.S.H
## Affluence                                                          
## Sngltns.n.T                                                        
## Snrs.n.Trct                                                        
## Afrcn.Am..T                                                        
## Nnctzns.n.T                                                        
## High.BP                                                            
## Bing.Drnkng                                                        
## Cancer                                                             
## Asthma                                                             
## Heart.Dises  0.335                                                 
## COPD        -0.321 -0.493                                          
## Smoking      0.144  0.084 -0.475                                   
## Diabetes    -0.106 -0.435 -0.005  0.277                            
## N.Physcl.Ac -0.021 -0.359  0.088 -0.274 -0.168                     
## Obesity     -0.124 -0.020  0.090 -0.220 -0.375 -0.044              
## Pr.Slpng.Hb  0.001  0.239 -0.091 -0.170 -0.061 -0.152 -0.115       
## Pr.Mntl.Hlt -0.438 -0.064 -0.390 -0.030  0.070 -0.088  0.024 -0.079

Testing Rate

testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]

col.state <- rep("pink", nrow(testing.data.state))

avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)

col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"

par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")

Pink highlights the last 14 days.

day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)

twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))

par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$rise.cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Cases of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$rise.deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Deaths of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)